{extend name="base/index"/}

{block name="page_location"}
<div class="row">
	<div class="col-12">
		<div class="page-title-box">
			<div class="page-title-right">
				<ol class="breadcrumb m-0">
					<li class="breadcrumb-item"><a href="{:url('index/index')}">管理中心</a></li>
					<li class="breadcrumb-item active"><i class="iconfont icon-angle-right"></i>导航管理</li>
				</ol>
			</div>
			<h4 class="page-title">
				所有导航
				<a href="javascript:;" data-toggle="modal" data-target="#new_box" id="add_nav_dig" class="btn btn-success btn-sm ml-3">创建新的导航</a>
				<a href="javascript:;" class="btn btn-primary btn-sm" id="Fast_Sort" attr-model="nav" attr-frm="nav_list_frm">更新排序</a>
			</h4>
		</div>
	</div>
</div>
{/block}

{block name="body"}  
<div class="row" id="nav_page">
	<div class="col-12">
		<div class="card">
			<div class="card-body">
				<form action="" id="nav_list_frm" method="post">
					<table class="table table-hover">
						<thead>
							<tr>
								<th>ID</th>
								<th>导航分类</th>
								<th>导航名称</th>
								<th>导航图片</th>
								<th>是否显示</th>
								<th>打开方式</th>
								<th>排序</th>
								<th>更新时间</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							{volist name='list' id="data"}
								<tr>
									<td>{$data.id}</td>
									<td>{$data.classname}</td>
									<td><span class="subtype_indent link">{$data.navname_indent}</span>
										{$data.navname}</td>
									<td><a href="javascript:;"><img class="list_facepic preview_img small" src="{$data.picurl|default='/static/admin/images/nopic.png'}" /></a></td>
									<td>
										{eq name="data.status" value="0"}
										<a href="javascript:;"  attr-model="nav" attr-id="{$data.id}" attr-field="status" attr-val="1"  class="badge badge-primary  Fast_Action">显示</a>
										{else /}
										<a href="javascript:;" attr-model="nav" attr-id="{$data.id}" attr-field="status" attr-val="0" class="badge badge-secondary  Fast_Action">不显示</a>
										{/eq}
									</td>
									<td>
										{eq name="data.openmode" value="_blank"}
										<a href="javascript:;" attr-model="nav" attr-id="{$data.id}" attr-field="openmode" attr-val="_self" class="badge badge-primary Fast_Action">新窗口</a>
										{else /}
										<a href="javascript:;" attr-model="nav" attr-id="{$data.id}" attr-field="openmode" attr-val="_blank" class="badge badge-secondary Fast_Action">原窗口</a>
										{/eq}                          	
									</td>    
									<td>
										<input type="hidden" name="field_ids[]" value="{$data.id}" />
										<input type="number" class="form-control orderid_ipt" name="orderid_ipt[]" value="{$data.orderid}">  
									</td>	                            
									<td><span class="badge badge-primary">{$data.posttime|date="m-d H:i",###}</span></td>
									<td>
										<a href="javascript:;" class="btn btn-primary btn-sm add_subnav_dig" attr-classid="{$data.classid}" attr-parentid="{$data.id}" data-toggle="modal" data-target="#new_box"><i class="iconfont icon-plus-circle-fill"></i>  创建子导航</a>
										<a href="javascript:;" class="btn btn-primary btn-sm edit_btn" attr-id="{$data.id}" data-toggle="modal" data-target="#new_box"><i class="iconfont icon-icon_compile"></i>  修改</a>
										<a href="javascript:;" class="btn btn-danger btn-sm Fast_Del"  attr-id="{$data.id}" attr-model="nav"><i class="iconfont icon-icon_delete_fill"></i> 删除</a>
									</td>
								</tr>
							{/volist}
						</tbody>
					</table>
                </form>							
			</div>
		</div>
	</div>
</div>
{/block}
{block name="modal_dig"}
<div class="modal fade" id="new_box" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog modal-full-700">
        <div class="modal-content">
          <div class="modal-header">
            <h4 class="modal-title dig_title" id="myModalLabel">创建新的导航</h4>
			<button type="button" class="close" data-dismiss="modal">x</button>
          </div>
          <div class="modal-body">
                <form action="#" class="form-horizontal" id="edit_nav_frm">
                	<input type="hidden" name="id" value="" />
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">选择所属分类：</label>
                        <div class="col-5">
                            <select class="form-control" tabindex="1" name="classid">
                                <option value="0">默认分类</option>
								{volist name="classlist" id="data"}
								<option value="{$data.id}">[{$data.id}]{$data.classname}</option>
								{/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">选择所属导航：</label>
                        <div class="col-5">
                            <select class="form-control" tabindex="1" name="parentid">
                                <option value="0">顶级导航</option>
                                {$nav_tree}
                            </select>
                        </div>
                    </div>                    
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">导航名称：</label>
                        <div class="col-5">
                            <input type="text" name="navname" placeholder="请输入导航名称" class="form-control ipt_check" data-type="string" data-len="1-100" nullmsg="导航名称不能为空" errormsg="导航名称由1-100个字符组成！"  value="">
                            <span class="font-13 text-muted">必填</span>
                        </div>
                    </div>
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">导航图标类名：</label>
                        <div class="col-3">
                            <input type="text" name="icon_class" placeholder="请选择图片" class="form-control" id="edit_icon" readonly="readonly">
                            <span class="font-13 text-muted"></span>
                        </div>
						<div class="col-3">
							<a class="btn btn-primary btn-sm select_icon_box" attr-id="#edit_icon" href="javascript:;">选择图标</a>
						</div>
                    </div>                    
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">导航地址：</label>
                        <div class="col-5">
                            <input type="text" name="linkurl" placeholder="请输入导航地址" class="form-control">
                        </div>
                    </div>
	                <div class="form-group row mb-1">
	                    <label class="col-3 col-form-label">导航图片上传：</label>
	                    <div class="col-5 picurl_box">
		                    <div class="picurl" data-type="upload" attr-inputname="picurl" attr-value=""  isCompress="1"></div>
	                    </div>
	                </div>
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">导航描述：</label>
                        <div class="col-5">
                            <textarea class="form-control" name="description" rows="3"></textarea>
                        </div>
                    </div>
	                <div class="form-group row mb-1">
	                    <label class="col-3 col-form-label">打开方式：</label>
	                    <div class="col-5">
							<div class="custom-control custom-radio">
								<input type="radio" name="openmode" id="openmode1" class="custom-control-input" value="_blank" checked="checked">
								<label class="custom-control-label" for="openmode1">新窗口</label>
							</div>
							<div class="custom-control custom-radio">
								<input type="radio" name="openmode" id="openmode2" class="custom-control-input" value="_self">
								<label class="custom-control-label" for="openmode2">原窗口</label>
							</div> 
	                    </div>
	                </div>                    
	                <div class="form-group row mb-1">
	                    <label class="col-3 col-form-label">是否显示：</label>
	                    <div class="col-5">
							<div class="custom-control custom-radio">
								<input type="radio" name="status" id="status1" class="custom-control-input" value="0" checked="checked">
								<label class="custom-control-label" for="status1">显示</label>
							</div>
							<div class="custom-control custom-radio">
								<input type="radio" name="status" id="status2" class="custom-control-input" value="1">
								<label class="custom-control-label" for="status2">不显示</label>
							</div>
	                    </div>
	                </div>
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">导航排序：</label>
                        <div class="col-2">
                            <input type="number" name="orderid" class="form-control" value="{$orderid}">
                        </div>
                    </div>	                
                </form>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
			<button type="button" class="btn btn-primary Fast_Form_Post" attr-frm="#edit_nav_frm" attr-callback="reload" attr-model="nav" attr-active="save_nav">保存</button>
          </div>
        </div>
      </div>
    </div>
	<div class="modal-body"  id="select_icon_box" style="background-color: #FFF;display: none;width:850px;">
		<input type="hidden" id="setinputid" value="" />
		<ul class="icon_list">
			{volist name="icon_list" id="icon"}
				<li><a href="javascript:;" attr-icon="{$icon.classname}"><span class="iconfont {$icon.classname}"></span></a></li>
			{/volist}
		</ul>
	</div>  
  
{/block}